<style>
    .form-group .col-sm-4{
        padding-bottom: 5px;
    }
    .nav-tabs{
        border-bottom: unset;
    }
    #extra1 .form-group .col-sm-2{padding-right: 0px;}
</style>
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <div class="col-md-6 col-sm-12">
        <div class="panel panel-default ">
            <div class="panel-heading">
                <div class="panel-lead">
                    <div class="panel-title">
                        <span style="font-weight: bold;font-style: normal;">{:__('基本信息')}</span>

                        <small style="margin-left: 10px;" class=" label bg-purple">总消费：{$row.purchase_total|htmlentities}</small>
                        <small style="margin-left: 10px;" class=" label bg-blue">下单：{$row.purchase_times|htmlentities}次</small></label>
                        <small style="margin-left: 10px;" class=" label bg-green">
                            {php}
                            $deal_time= \addons\facrm\library\Helper::timeTran($row['deal_time']);
                            echo  $deal_time?$deal_time.'下单':'无下单';
                            {/php}
                        </small>

                        <span class="label label-primary pull-right">
                            <a href="#" onclick="javascript:parent.Fast.api.open('facrm/customer/index/edit/ids/{$row.id|htmlentities}',__('修改客户信息-')+'{$row.name|htmlentities}');"> {:__('修改')}</a>
                        </span>
                    </div>
                </div>
            </div>
            <div class="panel-body" style="min-height: 286px;">
                <div class="tab-content">
                    <div class="tab-pane fade active in" id="extra">
                        <div class="form-group">
                            <label  class="control-label col-xs-12 col-sm-2 ">{:__('客户名称')}:</label>
                            <div class="col-xs-12 col-sm-8">
                                <label  class="control-label">{$row.name|htmlentities}({$row.id|htmlentities})</label>
                                {if $row['tags']}
                                <span class="label label-primary">{$row['tags']|htmlentities}</span>
                                {/if}
                            </div>
                        </div>


                        <div class="form-group">
                            <label for="c-mobile" class="control-label col-xs-12 col-sm-2">{:__('联系电话')}:</label>
                            <div class="col-xs-12 col-sm-8">
                                <div class="input-group">
                                    <input id="c-telephone" class="form-control" size="50" name="row[telephone]" type="text" value="{$row.telephone|htmlentities}"  readonly>
                                    <div class="input-group-addon no-border no-padding">
                                        <span>
                                            <button type="button"  class="btn btn-success cloudcall" data-type="customer" data-field="telephone" data-typeid="{$row.id|htmlentities}" data-name="{$row.name|htmlentities}"
                                            ><i class="fa fa-phone"></i> {:__('云呼')}</button></span>

                                    </div>
                                </div>

                            </div>
                        </div>


                        <div class="form-group">
                            <label for="c-mobile" class="control-label col-xs-12 col-sm-2">{:__('联系手机')}:</label>
                            <div class="col-xs-12 col-sm-8">
                                <div class="input-group">
                                    <input id="c-mobile" class="form-control" size="50" name="row[mobile]" type="text" value="{$row.mobile|htmlentities}"  readonly>
                                    <div class="input-group-addon no-border no-padding">
                                        <span>
                                            <button type="button"  class="btn btn-success cloudcall" data-type="customer" data-field="mobile" data-typeid="{$row.id|htmlentities}" data-name="{$row.name|htmlentities}"
                                            ><i class="fa fa-phone"></i> {:__('云呼')}</button></span>

                                    </div>
                                </div>

                            </div>
                        </div>


                        <div class="form-group">
                            <label for="c-remark" class="control-label col-xs-12 col-sm-2">{:__('备注')}:</label>
                            <div class="col-xs-12 col-sm-8">
                                <textarea id="c-remark" class="form-control" name="crow[remark]" disabled>{$row.remark|htmlentities}</textarea>
                            </div>
                        </div>
                        <div  id="hiddeninfo" style="display: none;">
                            <div class="form-group">
                                <label class="control-label col-xs-12 col-sm-2">{:__('客户等级')}:</label>
                                <div class="col-xs-12 col-sm-8">
                                    {:build_select('crow[level]', $levelList,$row.level, ['class'=>'form-control selectpicker', 'data-rule'=>'required'])}
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-xs-12 col-sm-2">{:__('客户行业')}:</label>
                                <div class="col-xs-12 col-sm-8">
                                    {:build_select('crow[industry]', $industryList, $row.industry, ['class'=>'form-control selectpicker', 'data-rule'=>'required'])}
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-xs-12 col-sm-2">{:__('客户行业')}:</label>
                                <div class="col-xs-12 col-sm-8">
                                    {:build_select('crow[source]', $sourceList, $row.source, ['class'=>'form-control selectpicker', 'data-rule'=>'required'])}
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="c-tags" class="control-label col-xs-12 col-sm-2">{:__('客户标签')}:</label>
                                <div class="col-xs-12 col-sm-8">
                                    <input id="c-tags" data-rule="" class="form-control"  name="row[tags]" type="text" readonly value="{$row.tags|htmlentities}">
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="c-address" class="control-label col-xs-12 col-sm-2">地址:</label>
                                <div class="col-xs-12 col-sm-8">
                                    <div class="form-inline" data-toggle="cxselect" data-selects="province,city,area">
                                        <select class="province form-control" name="province" data-url="ajax/area" readonly>
                                            <option value="{$row.province|htmlentities}" selected=""></option>
                                        </select>
                                        <select class="city form-control" name="city" data-url="ajax/area" readonly>
                                            <option value="{$row.city|htmlentities}" selected=""></option>
                                        </select>
                                        <select class="area form-control" name="area" data-url="ajax/area" readonly>
                                            <option value="{$row.area|htmlentities}" selected=""></option>
                                        </select>
                                    </div>
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="c-detail_address" class="control-label col-xs-12 col-sm-2">详细地址:</label>
                                <div class="col-xs-12 col-sm-8">
                                    <input id="c-detail_address" type="text" data-rule="required" class="form-control" name="crow[detail_address]" value="{$row.detail_address|htmlentities}" disabled />
                                </div>
                            </div>



                            <div id="extend"></div>

                        </div>
                        <div class="text-center"><a href="javascript:;" id="buttonshow">--{:__('更多信息')}--</a></div>

                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="col-md-6 col-sm-12">
        <div class="panel panel-default panel-success">
            <div class="panel-heading">
                <div class="panel-lead">
                    <span style="font-weight: bold;font-style: normal;">{:__('跟进操作')}</span>
                </div>
            </div>
            <div class="panel-body" style="min-height: 286px;">
                <div class="tab-content">
                    <div class="tab-pane fade active in" id="extra1">
                        <div class="form-group">
                            <label for="record-content" class="control-label col-xs-12 col-sm-2">{:__('跟进内容')}:</label>
                            <div class="col-xs-12 col-sm-8">
                                <textarea id="record-content"  data-rule="required" class="form-control " name="row[content]" rows="2"></textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('附件')}:</label>
                            <div class="col-xs-12 col-sm-8">
                                <div class="input-group">
                                    <input id="c-image" class="form-control" size="50" name="row[image]" type="text" value="" placeholder="可以为空">
                                    <div class="input-group-addon no-border no-padding">
                                        <span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="*" data-multiple="true" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('上传')}</button></span>

                                    </div>
                                    <span class="msg-box n-right" for="c-image"></span>
                                </div>
                                <ul class="row list-inline plupload-preview" id="p-image"></ul>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="c-next_time" class="control-label col-xs-12 col-sm-2">{:__('下次跟进')}:</label>
                            <div class="col-xs-12 col-sm-8">
                                <input id="c-next_time"  value=""  class="form-control datetimepicker"
                                       data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[next_time]" type="text" placeholder="{:__('下次跟进时间，如不需要再跟进留空')}" >

                            </div>
                        </div>
                        {if isset($status_row)&&$status_row['content_list']}
                        <div class="form-group">
                            <label class="control-label col-xs-12 col-sm-2">{:__('跟进状态')}:</label>
                            <div class="col-xs-12 col-sm-8">
                                <select class="form-control selectpicker" data-rule="required" name="row[follow_status]">
                                    {foreach name="$status_row['content_list']" item="vo"}
                                    <option value="{$key|htmlentities}" {in name="key" value="$row.follow_status" }selected{/in}>{$vo|htmlentities}</option>
                                    {/foreach}
                                </select>

                            </div>
                        </div>
                        {/if}
                        <div class="form-group">
                            <label class="control-label col-xs-12 col-sm-2">{:__('跟进方式')}:</label>
                            <div class="col-xs-12 col-sm-8">
                                <div class="input-group">
                                    {:build_select('row[record_type]', $record_type_list,0, ['class'=>'form-control selectpicker', 'data-rule'=>'required'])}
                                    <div class="input-group-addon no-border no-padding normal-footer">
                                        <button type="submit" class="btn btn-success btn-embossed  disabled">{:__('立即保存')}</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="col-md-12 col-sm-12">
    <div class="panel panel-default  panel-info">
        <div class="panel-heading" style="padding-bottom: 0;">
            <ul class="nav nav-tabs">

                <li class="active"><a href="#bulletin" role="tab" data-toggle="tab">{:__('跟进记录')}</a></li>
                {if($auth->check('facrm/customer/contacts/index'))}
				<li><a href="#forum" role="tab" data-toggle="tab">联系人</a></li>
				{/if}
                {if($auth->check('facrm/business/index'))}
                <li><a href="#business" role="tab"  data-toggle="tab">{:__('商机')}</a></li>
                {/if}
                {if($auth->check('facrm/customer/index/contractlist'))}
                <li><a href="#contract" role="tab"  data-toggle="tab">{:__('合同')}</a></li>
                {/if}
                {if($auth->check('facrm/customer/index/receivableslist'))}
                <li><a href="#receivables" role="tab"  data-toggle="tab">{:__('回款')}</a></li>
                {/if}
                <li><a href="#files12" role="tab"  data-toggle="tab">{:__('附件')}</a></li>
                {if($auth->check('facrm/operatelog/index'))}
                <li><a href="#" onclick="javascript:parent.Fast.api.open('facrm/operatelog/index/customer_id/{$row.id|htmlentities}',__('操作日志-')+'{$row.name|htmlentities}');" >{:__('日志')}</a></li>
                {/if}
                {if($auth->check('facrm/customer/record/calllog'))}
                <li><a href="#" onclick="javascript:Fast.api.open('facrm/customer/record/calllog?customer_id={$row.id|htmlentities}',__('通话记录-')+'{$row.name|htmlentities}');" >{:__('通话记录')}</a></li>
                {/if}

            </ul>
        </div>
        <div class="panel-body">
            <div id="myTabContent" class="tab-content">
                <div id="toolbar1" class="toolbar ">
                    <a href="javascript:;" class="btn btn-primary btn-refresh"><i class="fa fa-refresh"></i></a>
                </div>
                
               

               
                

                <!-- 跟进记录开始-->
                <div class="tab-pane fade active in" id="bulletin">
                    <table id="tableflow" class="table table-striped table-bordered table-hover table-nowrap" width="100%"></table>
                    <!-- 修改 amplam2018年8月11日 15:40:05--->
                </div>
                <!-- 跟进记录结束-->
				{if($auth->check('facrm/customer/contacts/index'))}
                <!-- 联系人开始-->
                <div class="tab-pane fade" id="forum">
					<div id="toolbar2" class="toolbar ">
						<a href="javascript:;" class="btn btn-primary btn-refresh"><i class="fa fa-refresh"></i></a>
						{if($auth->check('facrm/customer/contacts/add'))}
						<a href="javascript:;" data-url="facrm/customer/contacts/add/customer_id/{:input('ids')}" class="btn btn-success  btn-dialog "
						   title="添加联系人"><i class="fa fa-plus"></i> {:__('添加')}</a>
						{/if}
					</div>
                    <table id="contact" class="table table-striped table-bordered table-hover table-nowrap" width="100%"
                           data-operate-edit="{:$auth->check('facrm/customer/contacts/edit')}"
                           data-operate-del="{:$auth->check('facrm/customer/contacts/del')}"
                           data-operate-email="{:$auth->check('facrm/apps/email/send')}"
                           data-operate-sms="{:$auth->check('facrm/apps/sms/send')}">


                    </table>
                    <!-- 修改 amplam2018年8月13日 10:30:05--->
                </div>
				{/if}
                <!-- 联系人结束-->
                {if($auth->check('facrm/business/index'))}
                <!-- 商机开始-->
                <div class="tab-pane fade" id="business">
					 <div id="toolbar-business" class="toolbar ">
						<a href="javascript:;" class="btn btn-primary btn-refresh"><i class="fa fa-refresh"></i></a>
						{if($auth->check('facrm/business/index/add'))}
						<a href="javascript:;" data-url="facrm/business/index/add/customer_id/{:input('ids')}" class="btn btn-success  btn-dialog "
						   title="添加商机"><i class="fa fa-plus"></i> {:__('添加')}</a>
						{/if}
					</div>
                    <table id="t-business" class="table table-striped table-bordered table-hover table-nowrap" width="100%"></table>
                </div>
                {/if}
                <!-- 商机结束-->
                {if($auth->check('facrm/customer/index/contractlist'))}
                <!-- 合同开始-->
                <div class="tab-pane fade" id="contract">
					{if($auth->check('facrm/customer/index/contractlist'))}
					<div id="toolbar-contract" class="toolbar ">
						<a href="javascript:;" class="btn btn-primary btn-refresh"><i class="fa fa-refresh"></i></a>
						{if($auth->check('facrm/contract/index/contractadd'))}
						<a href="javascript:;" data-url="facrm/contract/index/contractadd/customer_id/{$row.id|htmlentities}" class="btn btn-success  btn-dialog "
						   title="添加合同"><i class="fa fa-plus"></i> {:__('添加')}</a>
						{/if}
					</div>
					{/if}
                    <table id="t-contract" class="table table-striped table-bordered table-hover table-nowrap" width="100%"></table>
                </div>
                <!-- 合同结束-->
                {/if}


                {if($auth->check('facrm/customer/index/receivableslist'))}
                <!-- 回款开始-->
                <div class="tab-pane fade" id="receivables">

                    <div class="panel-group" id="accordion">

                        <div class="panel panel-warning">
                            <div class="panel-heading">
                                <h4 class="panel-title">
                                    <a data-toggle="collapse"
                                       href="#panelplan">
                                        未回款计划
                                    </a>
                                </h4>
                            </div>

                            <div id="panelplan" class="panel-collapse collapse in">
                                <div class="panel-body">
                                    <table id="t-plan" class="table table-striped table-bordered table-hover table-nowrap" width="100%"></table>
                                </div>
                            </div>
                        </div>


                        <div class="panel panel-success">
                            <div class="panel-heading">
                                <h4 class="panel-title">
                                    <a data-toggle="collapse"
                                       href="#panelreceivables">
                                        回款列表
                                    </a>
                                </h4>
                            </div>

                            <div id="panelreceivables" class="panel-collapse collapse in">
                                <div class="panel-body">
                                    <div id="toolbar-receivables" class="toolbar ">
                                        <a href="javascript:;" class="btn btn-primary btn-refresh"><i class="fa fa-refresh"></i></a>
                                        {if($auth->check('facrm/contract/receivables/receivablesadd'))}
                                        <a href="javascript:;" data-url="facrm/contract/receivables/receivablesadd/customer_id/{:input('ids')}" class="btn btn-success  btn-dialog "
                                           title="添加回款"><i class="fa fa-plus"></i> {:__('添加')}</a>
                                        {/if}
                                    </div>
                                    <table id="t-receivables" class="table table-striped table-bordered table-hover table-nowrap" width="100%"></table>
                                </div>
                            </div>
                        </div>


                    </div>




                </div>
                <!-- 回款结束-->
                {/if}


                <!-- 附件-->
                <div class="tab-pane fade" id="files12">
                    <table id="t-files" class="table table-striped table-bordered table-hover table-nowrap" width="100%"></table>
                </div>
                <!-- 附件-->

            </div>
        </div>
    </div>

    </div>
					    
	
    <div class="form-group fixed-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">

            <button type="button" class="btn  btn-send-email  bg-purple {:$auth->check('facrm/apps/email/send')?'':'hide'} "
                    data-url="facrm/apps/email/send"
                    data-types="customer"
                    data-typesid="{$row.id|htmlentities}"
                    data-title="{:__('发邮件给客户：')}{$row.name|htmlentities}">{:__('发邮件')}</button>

            <button type="button" class="btn  btn-send-sms  btn-info {:$auth->check('facrm/apps/sms/send')?'':'hide'} "
                    data-url="facrm/apps/sms/send"
                    data-types="customer"
                    data-typesid="{$row.id|htmlentities}"
                    data-title="{:__('发信息给客户：')}{$row.name|htmlentities}">{:__('发信息')}</button>
            {if($auth->check('facrm/customer/index/next'))}
            <a class="btn  btn-primary  btn-next " href="javascript:;"
               data-title="{:__('下一个客户')}"
               data-url="facrm/customer/index/next">{:__('下一个')}</a>

            {/if}
            {if($auth->check('facrm/customer/index/deal')||$auth->check('facrm/contract/index/contractadd'))}
            <button type="button" class="btn  btn-success btn-dialog"
                    data-title="{:__('成交')}：{$row.name|htmlentities}"
                    data-url="{if $addon_config['deal']==1}facrm/customer/index/deal/ids/{$row.id|htmlentities}{else/}facrm/contract/index/contractadd/customer_id/{$row.id|htmlentities}{/if}">{:__('成交')}</button>

            {/if}

        </div>
    </div>
</form>
<script>
    var customer_id={:input('ids','','intval')};
    var record_type_list={:json_encode($record_type_list)};
</script>




